package com.lcz.googleplay.holder;

import android.view.View;

/**
 * Created by hp on 2016/10/28.
 */

public abstract class BaseHolder<T> {
    private View view;
    private T data;

    public BaseHolder() {
        view = init();
        view.setTag(this);
    }

    public View getView() {
        return view;
    }

    public void setData(T data) {
        this.data = data;
        refreshView(data);
    }

    /**
     * 初始化布局
     * @return
     */
    public abstract View init();

    /**
     * 初始化布局组件
     * @param data
     */
    public abstract void refreshView(T data);
}
